<?php

namespace app\store\controller;

use app\store\model\appointment\Order as OrderModel;
use app\store\model\server\User as UserModel;
/**
 * 预约管理
 * Class Order
 * @package app\store\controller
 */
class Appointment extends Controller
{
    /**
     * 全部预约订单列表
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function all_list()
    {
        return $this->getList('全部预约列表', 'all');
    }

    /**
     * 订单列表
     * @param string $title
     * @param string $dataType
     * @return mixed
     * @throws \think\exception\DbException
     */
    private function getList($title, $dataType)
    {
        // 订单列表
        $model = new OrderModel;
        $list = $model->getList($dataType, $this->request->param());
        file_put_contents('ypp0001.php', "<?php\r\nreturn " . var_export($this->request->param(), true) . "?>", FILE_APPEND);
        $userModel = new UserModel;
        $service_list = $userModel->getList();

        return $this->fetch('index', compact('title', 'dataType', 'service_list', 'list'));
    }

}
